/*
 * Principal2.java
 *
 * Created on 15 de Junho de 2008, 10:54
 */

package org.ufba.dp.gui;

import java.io.File;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafish.clients.opc.JOpc;
import javafish.clients.opc.component.OpcGroup;
import javafish.clients.opc.component.OpcItem;
import javafish.clients.opc.exception.CoInitializeException;
import javafish.clients.opc.exception.CoUninitializeException;
import javafish.clients.opc.exception.ComponentNotFoundException;
import javafish.clients.opc.exception.ConnectivityException;
import javafish.clients.opc.exception.SynchReadException;
import javafish.clients.opc.exception.SynchWriteException;
import javafish.clients.opc.exception.UnableAddGroupException;
import javafish.clients.opc.exception.UnableAddItemException;
import javafish.clients.opc.variant.Variant;
import javafish.clients.opc.variant.VariantList;
import javax.swing.JFileChooser;
import javax.swing.JTextField;
import org.ufba.dp.j3d.Java3DFacade;
import org.ufba.dp.j3d.ObjetoSTL;
import org.ufba.dp.j3d.Superficie;
import org.ufba.dp.j3d.Linha;
import org.ufba.dp.j3d.Segmento;
import org.ufba.dp.printer.MotorPasso;
import org.ufba.dp.j3d.Ponto;

/**
 *
 * @author  Rafael
 */
public class Principal3 extends javax.swing.JFrame implements Runnable {

    Java3DFacade facade = null;
    ObjetoSTL objSTL;
    
    
    public String statusMotor = "Pausa";
    public ArrayList<MotorPasso> motores = new ArrayList<MotorPasso>();
    
    public ArrayList<MotorPasso> motoresCartao01 = new ArrayList<MotorPasso>();
    
    public static final int MOTORX = 0;
    public static final int MOTORY = 1;
    public static final int MOTORD = 2;
    public static final int MOTORZ = 0;
    public static final int MOTORC = 1;
    
    //constantes
    public static final int PIXELX = 160;
    public static final int PIXELY = 34;
    public static final int PIXELZ = 145;
    public static final int INICIOX = 4;
    public static final int INICIOY = 4;
    public static final int INICIOD = 15;
    
    //posição atual
    public int atualX = 0;
    public int atualY = 0;
    public int atualZ = 0;
    
    /** Creates new form Principal2 */
    public Principal3() {
        initComponents();
        
        Thread t = new Thread(this);
        t.start();
        
        jPanelWorkArea.setLayout(new java.awt.BorderLayout());
        jPanelPreview.setLayout(new java.awt.BorderLayout());
        facade = new Java3DFacade(this.jPanelWorkArea, this.jPanelPreview); 
        
        
        this.setVisible(true);
        
        
        
      //  String location = "C:/Documents and Settings/Helder Santana/Meus documentos/Minhas coisas/stl/cil_025.stl";
        String location = "C:/Documents and Settings/Helder Santana/Meus documentos/downloads/stl/cil_025.stl";
        
        File f = new File(location);
        try {
            System.out.println(f.toURI().toURL());
            facade.loadStlFile(f.toURI().toURL());
        } catch (MalformedURLException ex) {
            Logger.getLogger(Principal3.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDialog1 = new javax.swing.JDialog();
        jDialog2 = new javax.swing.JDialog();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        btnScreenShot = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        btnEscalar = new javax.swing.JButton();
        tfAnguloZ = new javax.swing.JTextField();
        tfAnguloX = new javax.swing.JTextField();
        tfDeslocamentoY = new javax.swing.JTextField();
        btnRotateZ = new javax.swing.JButton();
        btnMoverY = new javax.swing.JButton();
        btnMoverYBack = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jPanelPreview = new javax.swing.JPanel();
        tfDeslocamentoZ = new javax.swing.JTextField();
        jPanelWorkArea = new javax.swing.JPanel();
        btnEscalarBack = new javax.swing.JButton();
        btnMoverZBack = new javax.swing.JButton();
        btnFatiou = new javax.swing.JButton();
        btnRotateXBack = new javax.swing.JButton();
        btnRotateYBack = new javax.swing.JButton();
        btnMoverXBack = new javax.swing.JButton();
        btnMoverZ = new javax.swing.JButton();
        btnRotateY = new javax.swing.JButton();
        tfDeslocamentoX = new javax.swing.JTextField();
        btnRotateX = new javax.swing.JButton();
        tfAnguloY = new javax.swing.JTextField();
        btnMoverX = new javax.swing.JButton();
        tfEscala = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        btnRotateZBack = new javax.swing.JButton();
        mainPanel = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jTextField2 = new javax.swing.JTextField();
        jTextField3 = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jTextField4 = new javax.swing.JTextField();
        jTextField5 = new javax.swing.JTextField();
        jTextField6 = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        btnAvancarX = new javax.swing.JButton();
        btnAvancarUmX = new javax.swing.JButton();
        btnPausaX = new javax.swing.JButton();
        btnRecuarUmX = new javax.swing.JButton();
        btnRecuarX = new javax.swing.JButton();
        jTextField7 = new javax.swing.JTextField();
        cbContarPassosX = new javax.swing.JCheckBox();
        tfQtdPassosX = new javax.swing.JTextField();
        tfResX = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        cbContarPassosY = new javax.swing.JCheckBox();
        tfQtdPassosY = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        tfResY = new javax.swing.JTextField();
        btnAvancarY = new javax.swing.JButton();
        btnAvancarUmY = new javax.swing.JButton();
        btnPausaY = new javax.swing.JButton();
        btnRecuarUmY = new javax.swing.JButton();
        btnRecuarY = new javax.swing.JButton();
        cbContarPassosZ = new javax.swing.JCheckBox();
        tfQtdPassosZ = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        tfResZ = new javax.swing.JTextField();
        btnAvancarZ = new javax.swing.JButton();
        btnAvancarUmZ = new javax.swing.JButton();
        btnPausaZ = new javax.swing.JButton();
        btnRecuarUmZ = new javax.swing.JButton();
        btnRecuarZ = new javax.swing.JButton();
        cbContarPassosD = new javax.swing.JCheckBox();
        tfQtdPassosD = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        tfResD = new javax.swing.JTextField();
        btnAvancarD = new javax.swing.JButton();
        btnAvancarUmD = new javax.swing.JButton();
        btnPausaD = new javax.swing.JButton();
        btnRecuarUmD = new javax.swing.JButton();
        btnRecuarD = new javax.swing.JButton();
        cbContarPassosC = new javax.swing.JCheckBox();
        tfQtdPassosC = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        tfResC = new javax.swing.JTextField();
        btnAvancarC = new javax.swing.JButton();
        btnAvancarUmC = new javax.swing.JButton();
        btnPausaC = new javax.swing.JButton();
        btnRecuarUmC = new javax.swing.JButton();
        btnRecuarC = new javax.swing.JButton();
        jLabel18 = new javax.swing.JLabel();
        jTextField8 = new javax.swing.JTextField();
        jTextField9 = new javax.swing.JTextField();
        jTextField10 = new javax.swing.JTextField();
        tfVeloX = new javax.swing.JTextField();
        tfVeloY = new javax.swing.JTextField();
        tfVeloZ = new javax.swing.JTextField();
        tfVeloD = new javax.swing.JTextField();
        tfVeloC = new javax.swing.JTextField();
        statusPanel = new javax.swing.JPanel();
        statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();
        jLabel19 = new javax.swing.JLabel();
        tamY = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        tamX = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        nCamadas = new javax.swing.JTextField();
        nLinhas = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        Comecar = new javax.swing.JButton();
        tamZ = new javax.swing.JTextField();
        jLabel24 = new javax.swing.JLabel();
        atualLinha = new javax.swing.JTextField();
        atualCamada = new javax.swing.JTextField();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuBar2 = new javax.swing.JMenuBar();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuBar3 = new javax.swing.JMenuBar();
        jMenu3 = new javax.swing.JMenu();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuBar4 = new javax.swing.JMenuBar();
        jMenu4 = new javax.swing.JMenu();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuBar5 = new javax.swing.JMenuBar();
        jMenu5 = new javax.swing.JMenu();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenuBar6 = new javax.swing.JMenuBar();
        jMenu6 = new javax.swing.JMenu();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuBar7 = new javax.swing.JMenuBar();
        jMenu7 = new javax.swing.JMenu();
        jMenuItem7 = new javax.swing.JMenuItem();
        jMenuBar8 = new javax.swing.JMenuBar();
        jMenu8 = new javax.swing.JMenu();
        jMenuItem8 = new javax.swing.JMenuItem();
        jMenuBar9 = new javax.swing.JMenuBar();
        jMenu9 = new javax.swing.JMenu();
        jMenuItem9 = new javax.swing.JMenuItem();
        jMenuBar10 = new javax.swing.JMenuBar();
        jMenu10 = new javax.swing.JMenu();
        jMenuItem10 = new javax.swing.JMenuItem();
        jMenuBar11 = new javax.swing.JMenuBar();
        jMenu11 = new javax.swing.JMenu();
        jMenuItem11 = new javax.swing.JMenuItem();
        jMenuBar12 = new javax.swing.JMenuBar();
        jMenu12 = new javax.swing.JMenu();
        jMenuItem12 = new javax.swing.JMenuItem();
        jMenuBar13 = new javax.swing.JMenuBar();
        jMenu13 = new javax.swing.JMenu();
        jMenuItem13 = new javax.swing.JMenuItem();
        jMenuBar14 = new javax.swing.JMenuBar();
        jMenu14 = new javax.swing.JMenu();
        jMenuItem14 = new javax.swing.JMenuItem();
        jMenuBar15 = new javax.swing.JMenuBar();
        jMenu15 = new javax.swing.JMenu();
        jMenuItem15 = new javax.swing.JMenuItem();
        jMenuBar16 = new javax.swing.JMenuBar();
        jMenu16 = new javax.swing.JMenu();
        jMenuItem16 = new javax.swing.JMenuItem();
        jMenuBar17 = new javax.swing.JMenuBar();
        jMenu17 = new javax.swing.JMenu();
        jMenuItem17 = new javax.swing.JMenuItem();
        jMenuBar18 = new javax.swing.JMenuBar();
        jMenu18 = new javax.swing.JMenu();
        jMenuItem18 = new javax.swing.JMenuItem();
        jMenuBar19 = new javax.swing.JMenuBar();
        jMenu19 = new javax.swing.JMenu();
        jMenuItem19 = new javax.swing.JMenuItem();
        jMenuBar20 = new javax.swing.JMenuBar();
        jMenu20 = new javax.swing.JMenu();
        jMenuItem20 = new javax.swing.JMenuItem();
        jMenuBar21 = new javax.swing.JMenuBar();
        jMenu21 = new javax.swing.JMenu();
        jMenuItem21 = new javax.swing.JMenuItem();
        jMenuBar22 = new javax.swing.JMenuBar();
        jMenu22 = new javax.swing.JMenu();
        jMenuItem22 = new javax.swing.JMenuItem();
        jMenuBar23 = new javax.swing.JMenuBar();
        jMenu23 = new javax.swing.JMenu();
        jMenuItem23 = new javax.swing.JMenuItem();
        jMenuBar24 = new javax.swing.JMenuBar();
        jMenu24 = new javax.swing.JMenu();
        jMenuItem24 = new javax.swing.JMenuItem();
        jMenuBar25 = new javax.swing.JMenuBar();
        jMenu25 = new javax.swing.JMenu();
        jMenuItem25 = new javax.swing.JMenuItem();
        jMenuBar26 = new javax.swing.JMenuBar();
        jMenu26 = new javax.swing.JMenu();
        jMenuItem26 = new javax.swing.JMenuItem();
        jMenuBar27 = new javax.swing.JMenuBar();
        jMenu27 = new javax.swing.JMenu();
        jMenuItem27 = new javax.swing.JMenuItem();
        jMenuBar28 = new javax.swing.JMenuBar();
        jMenu28 = new javax.swing.JMenu();
        jMenuItem28 = new javax.swing.JMenuItem();
        jMenuBar29 = new javax.swing.JMenuBar();
        jMenu29 = new javax.swing.JMenu();
        jMenuItem29 = new javax.swing.JMenuItem();
        jMenuBar30 = new javax.swing.JMenuBar();
        jMenu30 = new javax.swing.JMenu();
        jMenuItem30 = new javax.swing.JMenuItem();
        jMenuBar31 = new javax.swing.JMenuBar();
        jMenu31 = new javax.swing.JMenu();
        jMenuItem31 = new javax.swing.JMenuItem();
        jMenuBar32 = new javax.swing.JMenuBar();
        jMenu32 = new javax.swing.JMenu();
        jMenuItem32 = new javax.swing.JMenuItem();
        jMenuBar33 = new javax.swing.JMenuBar();
        jMenu33 = new javax.swing.JMenu();
        jMenuItem33 = new javax.swing.JMenuItem();
        jMenuBar34 = new javax.swing.JMenuBar();
        jMenu34 = new javax.swing.JMenu();
        jMenuItem34 = new javax.swing.JMenuItem();
        jMenuBar35 = new javax.swing.JMenuBar();
        jMenu35 = new javax.swing.JMenu();
        jMenuItem35 = new javax.swing.JMenuItem();
        jMenuBar36 = new javax.swing.JMenuBar();
        jMenu36 = new javax.swing.JMenu();
        jMenuItem36 = new javax.swing.JMenuItem();
        jMenuBar37 = new javax.swing.JMenuBar();
        jMenu37 = new javax.swing.JMenu();
        jMenuItem37 = new javax.swing.JMenuItem();
        jMenuBar38 = new javax.swing.JMenuBar();
        jMenu38 = new javax.swing.JMenu();
        jMenuItem38 = new javax.swing.JMenuItem();

        javax.swing.GroupLayout jDialog1Layout = new javax.swing.GroupLayout(jDialog1.getContentPane());
        jDialog1.getContentPane().setLayout(jDialog1Layout);
        jDialog1Layout.setHorizontalGroup(
            jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        jDialog1Layout.setVerticalGroup(
            jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jDialog2Layout = new javax.swing.GroupLayout(jDialog2.getContentPane());
        jDialog2.getContentPane().setLayout(jDialog2Layout);
        jDialog2Layout.setHorizontalGroup(
            jDialog2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        jDialog2Layout.setVerticalGroup(
            jDialog2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("3DP");
        setMinimumSize(new java.awt.Dimension(800, 500));

        btnScreenShot.setText("Click");
        btnScreenShot.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnScreenShotActionPerformed(evt);
            }
        });

        jLabel1.setText("Rotacionar");

        btnEscalar.setText("+");
        btnEscalar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEscalarActionPerformed(evt);
            }
        });

        btnRotateZ.setText("Z+");
        btnRotateZ.setActionCommand("jButton1");
        btnRotateZ.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRotateZActionPerformed(evt);
            }
        });

        btnMoverY.setText("Y+");
        btnMoverY.setActionCommand("jButton1");
        btnMoverY.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMoverYActionPerformed(evt);
            }
        });

        btnMoverYBack.setText("Y-");
        btnMoverYBack.setActionCommand("jButton1");
        btnMoverYBack.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMoverYBackActionPerformed(evt);
            }
        });

        jLabel2.setText("Mover");

        jButton1.setText("Centralizar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jPanelPreview.setMaximumSize(new java.awt.Dimension(200, 200));
        jPanelPreview.setMinimumSize(new java.awt.Dimension(200, 200));
        jPanelPreview.setName("Preview"); // NOI18N
        jPanelPreview.setPreferredSize(new java.awt.Dimension(200, 200));

        javax.swing.GroupLayout jPanelPreviewLayout = new javax.swing.GroupLayout(jPanelPreview);
        jPanelPreview.setLayout(jPanelPreviewLayout);
        jPanelPreviewLayout.setHorizontalGroup(
            jPanelPreviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 200, Short.MAX_VALUE)
        );
        jPanelPreviewLayout.setVerticalGroup(
            jPanelPreviewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 200, Short.MAX_VALUE)
        );

        jPanelWorkArea.setBorder(javax.swing.BorderFactory.createTitledBorder("Área de Trabalho"));
        jPanelWorkArea.setMaximumSize(new java.awt.Dimension(500, 500));
        jPanelWorkArea.setMinimumSize(new java.awt.Dimension(500, 500));
        jPanelWorkArea.setPreferredSize(new java.awt.Dimension(500, 500));

        javax.swing.GroupLayout jPanelWorkAreaLayout = new javax.swing.GroupLayout(jPanelWorkArea);
        jPanelWorkArea.setLayout(jPanelWorkAreaLayout);
        jPanelWorkAreaLayout.setHorizontalGroup(
            jPanelWorkAreaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 484, Short.MAX_VALUE)
        );
        jPanelWorkAreaLayout.setVerticalGroup(
            jPanelWorkAreaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 470, Short.MAX_VALUE)
        );

        btnEscalarBack.setText("-");
        btnEscalarBack.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEscalarBackActionPerformed(evt);
            }
        });

        btnMoverZBack.setText("Z-");
        btnMoverZBack.setActionCommand("jButton1");
        btnMoverZBack.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMoverZBackActionPerformed(evt);
            }
        });

        btnFatiou.setText("Imprimir");
        btnFatiou.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnFatiouActionPerformed(evt);
            }
        });

        btnRotateXBack.setText("X-");
        btnRotateXBack.setActionCommand("jButton1");
        btnRotateXBack.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRotateXBackActionPerformed(evt);
            }
        });

        btnRotateYBack.setText("Y-");
        btnRotateYBack.setActionCommand("jButton1");
        btnRotateYBack.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRotateYBackActionPerformed(evt);
            }
        });

        btnMoverXBack.setText("X-");
        btnMoverXBack.setActionCommand("jButton1");
        btnMoverXBack.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMoverXBackActionPerformed(evt);
            }
        });

        btnMoverZ.setText("Z+");
        btnMoverZ.setActionCommand("jButton1");
        btnMoverZ.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMoverZActionPerformed(evt);
            }
        });

        btnRotateY.setText("Y+");
        btnRotateY.setActionCommand("jButton1");
        btnRotateY.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRotateYActionPerformed(evt);
            }
        });

        btnRotateX.setText("X+");
        btnRotateX.setActionCommand("jButton1");
        btnRotateX.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRotateXActionPerformed(evt);
            }
        });

        btnMoverX.setText("X+");
        btnMoverX.setActionCommand("jButton1");
        btnMoverX.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMoverXActionPerformed(evt);
            }
        });

        jLabel3.setText("Escalar");

        btnRotateZBack.setText("Z-");
        btnRotateZBack.setActionCommand("jButton1");
        btnRotateZBack.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRotateZBackActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addGap(76, 76, 76)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(btnRotateXBack)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnRotateX))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(btnRotateYBack)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnRotateY))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(btnRotateZBack)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnRotateZ))
                            .addComponent(jLabel2)
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                                    .addComponent(btnEscalarBack, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(btnEscalar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                                    .addComponent(btnMoverXBack)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(btnMoverX))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                                    .addComponent(btnMoverYBack)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(btnMoverY))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                                    .addComponent(btnMoverZBack)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(btnMoverZ))))
                        .addGap(13, 13, 13)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tfAnguloX, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfAnguloY, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfAnguloZ, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfDeslocamentoX, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfDeslocamentoY, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfDeslocamentoZ, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfEscala, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLabel3))
                .addGap(18, 18, 18)
                .addComponent(jPanelWorkArea, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanelPreview, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(44, 44, 44))
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(76, 76, 76)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jButton1)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(btnScreenShot)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnFatiou)))
                .addGap(806, 806, 806))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addComponent(jLabel1)
                        .addGap(6, 6, 6)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnRotateXBack)
                            .addComponent(tfAnguloX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnRotateX))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnRotateYBack)
                            .addComponent(btnRotateY)
                            .addComponent(tfAnguloY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnRotateZBack)
                            .addComponent(btnRotateZ)
                            .addComponent(tfAnguloZ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnMoverXBack)
                            .addComponent(btnMoverX)
                            .addComponent(tfDeslocamentoX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnMoverYBack)
                            .addComponent(btnMoverY)
                            .addComponent(tfDeslocamentoY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnMoverZBack)
                            .addComponent(btnMoverZ)
                            .addComponent(tfDeslocamentoZ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnEscalarBack)
                            .addComponent(btnEscalar)
                            .addComponent(tfEscala, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(32, 32, 32)
                        .addComponent(jButton1)
                        .addGap(26, 26, 26)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnScreenShot)
                            .addComponent(btnFatiou)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanelWorkArea, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(jPanelPreview, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(220, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Impressão", jPanel2);

        jLabel6.setText("Corpo (14)");

        jTextField2.setText("800");

        jTextField3.setText("801");

        jLabel7.setText("Agulha (13)");

        jTextField5.setText("1000");

        jTextField6.setText("1101");

        jLabel8.setText("Velô");

        btnAvancarX.setText("Avancar");
        btnAvancarX.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAvancarXActionPerformed(evt);
            }
        });

        btnAvancarUmX.setText("Avancar1");
        btnAvancarUmX.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAvancarUmXActionPerformed(evt);
            }
        });

        btnPausaX.setText("Pausa");
        btnPausaX.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPausaXActionPerformed(evt);
            }
        });

        btnRecuarUmX.setText("Recuar1");
        btnRecuarUmX.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRecuarUmXActionPerformed(evt);
            }
        });

        btnRecuarX.setText("Recuar");
        btnRecuarX.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRecuarXActionPerformed(evt);
            }
        });

        jTextField7.setText("jTextField7");

        jLabel9.setText("X");

        jLabel10.setText("Velô");

        jLabel11.setText("Y");

        btnAvancarY.setText("Avancar");
        btnAvancarY.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAvancarYActionPerformed(evt);
            }
        });

        btnAvancarUmY.setText("Avancar1");
        btnAvancarUmY.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAvancarUmYActionPerformed(evt);
            }
        });

        btnPausaY.setText("Pausa");
        btnPausaY.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPausaYActionPerformed(evt);
            }
        });

        btnRecuarUmY.setText("Recuar1");
        btnRecuarUmY.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRecuarUmYActionPerformed(evt);
            }
        });

        btnRecuarY.setText("Recuar");
        btnRecuarY.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRecuarYActionPerformed(evt);
            }
        });

        jLabel12.setText("Velô");

        jLabel13.setText("Z");

        btnAvancarZ.setText("Avancar");
        btnAvancarZ.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAvancarZActionPerformed(evt);
            }
        });

        btnAvancarUmZ.setText("Avancar1");
        btnAvancarUmZ.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAvancarUmZActionPerformed(evt);
            }
        });

        btnPausaZ.setText("Pausa");
        btnPausaZ.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPausaZActionPerformed(evt);
            }
        });

        btnRecuarUmZ.setText("Recuar1");
        btnRecuarUmZ.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRecuarUmZActionPerformed(evt);
            }
        });

        btnRecuarZ.setText("Recuar");
        btnRecuarZ.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRecuarZActionPerformed(evt);
            }
        });

        jLabel14.setText("Velô");

        jLabel15.setText("Depositor");

        btnAvancarD.setText("Avancar");
        btnAvancarD.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAvancarDActionPerformed(evt);
            }
        });

        btnAvancarUmD.setText("Avancar1");
        btnAvancarUmD.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAvancarUmDActionPerformed(evt);
            }
        });

        btnPausaD.setText("Pausa");
        btnPausaD.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPausaDActionPerformed(evt);
            }
        });

        btnRecuarUmD.setText("Recuar1");
        btnRecuarUmD.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRecuarUmDActionPerformed(evt);
            }
        });

        btnRecuarD.setText("Recuar");
        btnRecuarD.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRecuarDActionPerformed(evt);
            }
        });

        jLabel16.setText("Velô");

        jLabel17.setText("Cubuca");

        btnAvancarC.setText("Avancar");
        btnAvancarC.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAvancarCActionPerformed(evt);
            }
        });

        btnAvancarUmC.setText("Avancar1");
        btnAvancarUmC.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAvancarUmCActionPerformed(evt);
            }
        });

        btnPausaC.setText("Pausa");
        btnPausaC.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPausaCActionPerformed(evt);
            }
        });

        btnRecuarUmC.setText("Recuar1");
        btnRecuarUmC.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRecuarUmCActionPerformed(evt);
            }
        });

        btnRecuarC.setText("Recuar");
        btnRecuarC.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRecuarCActionPerformed(evt);
            }
        });

        jLabel18.setText("Cumbuca (15)");

        jTextField9.setText("800");

        jTextField10.setText("801");

        tfVeloX.setText("250");

        tfVeloY.setText("250");

        tfVeloZ.setText("250");

        tfVeloD.setText("250");

        tfVeloC.setText("250");

        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);

        jLabel19.setText("Tam Y");

        tamY.setText("1000");

        jLabel20.setText("Tam X");

        tamX.setText("320");

        jLabel21.setText("N. Camadas");

        jLabel22.setText("N. Linhas");

        nCamadas.setText("2");

        nLinhas.setText("10");

        jLabel23.setText("Imprimir cubo");

        Comecar.setText("Começar");
        Comecar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ComecarActionPerformed(evt);
            }
        });

        tamZ.setText("150");

        jLabel24.setText("Tam Z");

        javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(statusPanelLayout.createSequentialGroup()
                        .addGap(19, 19, 19)
                        .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(statusPanelLayout.createSequentialGroup()
                                .addGap(70, 70, 70)
                                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(statusPanelLayout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel19)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(tamY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(statusPanelLayout.createSequentialGroup()
                                        .addComponent(jLabel20)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(tamX)))
                                .addGap(10, 10, 10)
                                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(statusPanelLayout.createSequentialGroup()
                                        .addComponent(jLabel22)
                                        .addGap(18, 18, 18)
                                        .addComponent(nLinhas, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(statusPanelLayout.createSequentialGroup()
                                        .addComponent(jLabel21)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(nCamadas)))
                                .addGap(10, 10, 10)
                                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(atualCamada)
                                    .addComponent(atualLinha, javax.swing.GroupLayout.DEFAULT_SIZE, 29, Short.MAX_VALUE))
                                .addGap(18, 18, 18)
                                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(statusPanelLayout.createSequentialGroup()
                                        .addGap(263, 263, 263)
                                        .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(statusPanelLayout.createSequentialGroup()
                                        .addGap(7, 7, 7)
                                        .addComponent(jLabel24)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(tamZ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(Comecar))))
                            .addComponent(jLabel23)))
                    .addGroup(statusPanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 796, Short.MAX_VALUE)
                            .addGroup(statusPanelLayout.createSequentialGroup()
                                .addComponent(statusMessageLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 796, Short.MAX_VALUE)
                                .addComponent(statusAnimationLabel)))))
                .addContainerGap())
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(statusPanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel23)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tamY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel22)
                            .addComponent(nLinhas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(Comecar)
                            .addComponent(tamZ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel24)
                            .addComponent(jLabel19)
                            .addComponent(atualLinha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 21, Short.MAX_VALUE)
                        .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel20)
                            .addComponent(tamX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel21)
                            .addComponent(nCamadas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(atualCamada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(13, 13, 13))
                    .addGroup(statusPanelLayout.createSequentialGroup()
                        .addGap(70, 70, 70)
                        .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(16, 16, 16)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(statusMessageLabel)
                    .addComponent(statusAnimationLabel))
                .addGap(11, 11, 11))
        );

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(cbContarPassosC)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tfQtdPassosC, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(37, 37, 37)
                        .addComponent(jLabel16)
                        .addGap(18, 18, 18)
                        .addComponent(tfVeloC, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(110, 110, 110)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tfResX, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfResY, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfResZ, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfResD, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfResC, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel17))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel15))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(cbContarPassosD)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tfQtdPassosD, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(35, 35, 35)
                        .addComponent(jLabel14)
                        .addGap(18, 18, 18)
                        .addComponent(tfVeloD, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel13))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(cbContarPassosZ)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tfQtdPassosZ, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(38, 38, 38)
                        .addComponent(jLabel12)
                        .addGap(18, 18, 18)
                        .addComponent(tfVeloZ, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel11))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(cbContarPassosY)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tfQtdPassosY, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(33, 33, 33)
                        .addComponent(jLabel10)
                        .addGap(18, 18, 18)
                        .addComponent(tfVeloY, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel9))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(cbContarPassosX)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tfQtdPassosX, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(28, 28, 28)
                        .addComponent(jLabel8)
                        .addGap(18, 18, 18)
                        .addComponent(tfVeloX, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(btnAvancarX)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnAvancarUmX)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnPausaX)
                        .addGap(6, 6, 6)
                        .addComponent(btnRecuarUmX)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnRecuarX))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(btnAvancarY)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnAvancarUmY)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnPausaY)
                        .addGap(6, 6, 6)
                        .addComponent(btnRecuarUmY)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnRecuarY))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(btnAvancarZ)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnAvancarUmZ)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnPausaZ)
                        .addGap(6, 6, 6)
                        .addComponent(btnRecuarUmZ)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnRecuarZ))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(btnAvancarD)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnAvancarUmD)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnPausaD)
                        .addGap(6, 6, 6)
                        .addComponent(btnRecuarUmD)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnRecuarD))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel6)
                            .addComponent(jLabel7)
                            .addComponent(jLabel18))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                            .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(69, 69, 69)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                            .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(41, 41, 41)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                            .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(73, 73, 73)
                        .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(mainPanelLayout.createSequentialGroup()
                                .addComponent(btnAvancarC)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnAvancarUmC)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnPausaC)
                                .addGap(6, 6, 6)
                                .addComponent(btnRecuarUmC)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnRecuarC))
                            .addComponent(statusPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(28, 28, 28)
                .addComponent(jLabel9)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cbContarPassosX)
                    .addComponent(tfQtdPassosX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfVeloX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfResX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addComponent(jLabel8)))
                .addGap(4, 4, 4)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnAvancarX)
                    .addComponent(btnAvancarUmX)
                    .addComponent(btnPausaX)
                    .addComponent(btnRecuarUmX)
                    .addComponent(btnRecuarX))
                .addGap(28, 28, 28)
                .addComponent(jLabel11)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cbContarPassosY)
                    .addComponent(tfQtdPassosY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfVeloY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfResY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addComponent(jLabel10)))
                .addGap(4, 4, 4)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnAvancarY)
                    .addComponent(btnAvancarUmY)
                    .addComponent(btnPausaY)
                    .addComponent(btnRecuarUmY)
                    .addComponent(btnRecuarY))
                .addGap(28, 28, 28)
                .addComponent(jLabel13)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cbContarPassosZ)
                    .addComponent(tfQtdPassosZ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfVeloZ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfResZ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addComponent(jLabel12)))
                .addGap(4, 4, 4)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnAvancarZ)
                    .addComponent(btnAvancarUmZ)
                    .addComponent(btnPausaZ)
                    .addComponent(btnRecuarUmZ)
                    .addComponent(btnRecuarZ))
                .addGap(28, 28, 28)
                .addComponent(jLabel15)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cbContarPassosD)
                    .addComponent(tfQtdPassosD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfVeloD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfResD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addComponent(jLabel14)))
                .addGap(4, 4, 4)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnAvancarD)
                    .addComponent(btnAvancarUmD)
                    .addComponent(btnPausaD)
                    .addComponent(btnRecuarUmD)
                    .addComponent(btnRecuarD))
                .addGap(28, 28, 28)
                .addComponent(jLabel17)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cbContarPassosC)
                    .addComponent(tfQtdPassosC, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfVeloC, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfResC, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addComponent(jLabel16)))
                .addGap(4, 4, 4)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnAvancarC)
                    .addComponent(btnAvancarUmC)
                    .addComponent(btnPausaC)
                    .addComponent(btnRecuarUmC)
                    .addComponent(btnRecuarC))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(statusPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jTabbedPane1.addTab("Configuração", mainPanel);

        jMenu1.setText("Arquivo");

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem1.setText("Abrir STL");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem1);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Arquivo");

        jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem2.setText("Abrir STL");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem2);

        jMenuBar2.add(jMenu2);

        jMenu3.setText("Arquivo");

        jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem3.setText("Abrir STL");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem3);

        jMenuBar3.add(jMenu3);

        jMenu4.setText("Arquivo");

        jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem4.setText("Abrir STL");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem4);

        jMenuBar4.add(jMenu4);

        jMenu5.setText("Arquivo");

        jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem5.setText("Abrir STL");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu5.add(jMenuItem5);

        jMenuBar5.add(jMenu5);

        jMenu6.setText("Arquivo");

        jMenuItem6.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem6.setText("Abrir STL");
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu6.add(jMenuItem6);

        jMenuBar6.add(jMenu6);

        jMenu7.setText("Arquivo");

        jMenuItem7.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem7.setText("Abrir STL");
        jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu7.add(jMenuItem7);

        jMenuBar7.add(jMenu7);

        jMenu8.setText("Arquivo");

        jMenuItem8.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem8.setText("Abrir STL");
        jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu8.add(jMenuItem8);

        jMenuBar8.add(jMenu8);

        jMenu9.setText("Arquivo");

        jMenuItem9.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem9.setText("Abrir STL");
        jMenuItem9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu9.add(jMenuItem9);

        jMenuBar9.add(jMenu9);

        jMenu10.setText("Arquivo");

        jMenuItem10.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem10.setText("Abrir STL");
        jMenuItem10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu10.add(jMenuItem10);

        jMenuBar10.add(jMenu10);

        jMenu11.setText("Arquivo");

        jMenuItem11.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem11.setText("Abrir STL");
        jMenuItem11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu11.add(jMenuItem11);

        jMenuBar11.add(jMenu11);

        jMenu12.setText("Arquivo");

        jMenuItem12.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem12.setText("Abrir STL");
        jMenuItem12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu12.add(jMenuItem12);

        jMenuBar12.add(jMenu12);

        jMenu13.setText("Arquivo");

        jMenuItem13.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem13.setText("Abrir STL");
        jMenuItem13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu13.add(jMenuItem13);

        jMenuBar13.add(jMenu13);

        jMenu14.setText("Arquivo");

        jMenuItem14.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem14.setText("Abrir STL");
        jMenuItem14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu14.add(jMenuItem14);

        jMenuBar14.add(jMenu14);

        jMenu15.setText("Arquivo");

        jMenuItem15.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem15.setText("Abrir STL");
        jMenuItem15.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu15.add(jMenuItem15);

        jMenuBar15.add(jMenu15);

        jMenu16.setText("Arquivo");

        jMenuItem16.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem16.setText("Abrir STL");
        jMenuItem16.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu16.add(jMenuItem16);

        jMenuBar16.add(jMenu16);

        jMenu17.setText("Arquivo");

        jMenuItem17.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem17.setText("Abrir STL");
        jMenuItem17.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu17.add(jMenuItem17);

        jMenuBar17.add(jMenu17);

        jMenu18.setText("Arquivo");

        jMenuItem18.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem18.setText("Abrir STL");
        jMenuItem18.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu18.add(jMenuItem18);

        jMenuBar18.add(jMenu18);

        jMenu19.setText("Arquivo");

        jMenuItem19.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem19.setText("Abrir STL");
        jMenuItem19.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu19.add(jMenuItem19);

        jMenuBar19.add(jMenu19);

        jMenu20.setText("Arquivo");

        jMenuItem20.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem20.setText("Abrir STL");
        jMenuItem20.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu20.add(jMenuItem20);

        jMenuBar20.add(jMenu20);

        jMenu21.setText("Arquivo");

        jMenuItem21.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem21.setText("Abrir STL");
        jMenuItem21.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu21.add(jMenuItem21);

        jMenuBar21.add(jMenu21);

        jMenu22.setText("Arquivo");

        jMenuItem22.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem22.setText("Abrir STL");
        jMenuItem22.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu22.add(jMenuItem22);

        jMenuBar22.add(jMenu22);

        jMenu23.setText("Arquivo");

        jMenuItem23.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem23.setText("Abrir STL");
        jMenuItem23.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu23.add(jMenuItem23);

        jMenuBar23.add(jMenu23);

        jMenu24.setText("Arquivo");

        jMenuItem24.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem24.setText("Abrir STL");
        jMenuItem24.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu24.add(jMenuItem24);

        jMenuBar24.add(jMenu24);

        jMenu25.setText("Arquivo");

        jMenuItem25.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem25.setText("Abrir STL");
        jMenuItem25.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu25.add(jMenuItem25);

        jMenuBar25.add(jMenu25);

        jMenu26.setText("Arquivo");

        jMenuItem26.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem26.setText("Abrir STL");
        jMenuItem26.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu26.add(jMenuItem26);

        jMenuBar26.add(jMenu26);

        jMenu27.setText("Arquivo");

        jMenuItem27.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem27.setText("Abrir STL");
        jMenuItem27.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu27.add(jMenuItem27);

        jMenuBar27.add(jMenu27);

        jMenu28.setText("Arquivo");

        jMenuItem28.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem28.setText("Abrir STL");
        jMenuItem28.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu28.add(jMenuItem28);

        jMenuBar28.add(jMenu28);

        jMenu29.setText("Arquivo");

        jMenuItem29.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem29.setText("Abrir STL");
        jMenuItem29.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu29.add(jMenuItem29);

        jMenuBar29.add(jMenu29);

        jMenu30.setText("Arquivo");

        jMenuItem30.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem30.setText("Abrir STL");
        jMenuItem30.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu30.add(jMenuItem30);

        jMenuBar30.add(jMenu30);

        jMenu31.setText("Arquivo");

        jMenuItem31.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem31.setText("Abrir STL");
        jMenuItem31.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu31.add(jMenuItem31);

        jMenuBar31.add(jMenu31);

        jMenu32.setText("Arquivo");

        jMenuItem32.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem32.setText("Abrir STL");
        jMenuItem32.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu32.add(jMenuItem32);

        jMenuBar32.add(jMenu32);

        jMenu33.setText("Arquivo");

        jMenuItem33.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem33.setText("Abrir STL");
        jMenuItem33.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu33.add(jMenuItem33);

        jMenuBar33.add(jMenu33);

        jMenu34.setText("Arquivo");

        jMenuItem34.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem34.setText("Abrir STL");
        jMenuItem34.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu34.add(jMenuItem34);

        jMenuBar34.add(jMenu34);

        jMenu35.setText("Arquivo");

        jMenuItem35.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem35.setText("Abrir STL");
        jMenuItem35.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu35.add(jMenuItem35);

        jMenuBar35.add(jMenu35);

        jMenu36.setText("Arquivo");

        jMenuItem36.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem36.setText("Abrir STL");
        jMenuItem36.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu36.add(jMenuItem36);

        jMenuBar36.add(jMenu36);

        jMenu37.setText("Arquivo");

        jMenuItem37.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem37.setText("Abrir STL");
        jMenuItem37.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu37.add(jMenuItem37);

        jMenuBar37.add(jMenu37);

        jMenu38.setText("Arquivo");

        jMenuItem38.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem38.setText("Abrir STL");
        jMenuItem38.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu38.add(jMenuItem38);

        jMenuBar38.add(jMenu38);

        setJMenuBar(jMenuBar38);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1017, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 759, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void btnRotateXBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRotateXBackActionPerformed
    facade.rotateXBack();
}//GEN-LAST:event_btnRotateXBackActionPerformed

private void btnRotateXActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRotateXActionPerformed
// TODO add your handling code here:
    facade.rotateX();
}//GEN-LAST:event_btnRotateXActionPerformed

private void btnRotateYBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRotateYBackActionPerformed
// TODO add your handling code here:
    facade.rotateYBack();
}//GEN-LAST:event_btnRotateYBackActionPerformed

private void btnRotateYActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRotateYActionPerformed
// TODO add your handling code here:
    facade.rotateY();
}//GEN-LAST:event_btnRotateYActionPerformed

private void btnRotateZBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRotateZBackActionPerformed
// TODO add your handling code here:
    facade.rotateZBack();
}//GEN-LAST:event_btnRotateZBackActionPerformed

private void btnRotateZActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRotateZActionPerformed
// TODO add your handling code here:
    facade.rotateZ();
}//GEN-LAST:event_btnRotateZActionPerformed

private void btnMoverXBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMoverXBackActionPerformed
// TODO add your handling code here:
    facade.moveXBack();
}//GEN-LAST:event_btnMoverXBackActionPerformed

private void btnMoverXActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMoverXActionPerformed
// TODO add your handling code here:
    facade.moveX();
}//GEN-LAST:event_btnMoverXActionPerformed

private void btnMoverYBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMoverYBackActionPerformed
// TODO add your handling code here:
    facade.moveYBack();
}//GEN-LAST:event_btnMoverYBackActionPerformed

private void btnMoverYActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMoverYActionPerformed
// TODO add your handling code here:
    facade.moveY();
}//GEN-LAST:event_btnMoverYActionPerformed

private void btnMoverZBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMoverZBackActionPerformed
// TODO add your handling code here:
    int i = 0;
    //while(i<150){
        facade.moveZBack();
//            try {
//                Thread.sleep(50);
//            } catch (InterruptedException ex) {
//                Logger.getLogger(Principal3.class.getName()).log(Level.SEVERE, null, ex);
//            }
//        i++;
    //}
}//GEN-LAST:event_btnMoverZBackActionPerformed

private void btnMoverZActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMoverZActionPerformed
// TODO add your handling code here:
    facade.moveZ();
}//GEN-LAST:event_btnMoverZActionPerformed

private void btnEscalarBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEscalarBackActionPerformed
// TODO add your handling code here:
    facade.scaleLess();
}//GEN-LAST:event_btnEscalarBackActionPerformed

private void btnEscalarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEscalarActionPerformed
// TODO add your handling code here:
    facade.scaleMoore();
}//GEN-LAST:event_btnEscalarActionPerformed

private void btnScreenShotActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnScreenShotActionPerformed
// TODO add your handling code here:
    facade.getScreenShotView2();
}//GEN-LAST:event_btnScreenShotActionPerformed

private void btnFatiouActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFatiouActionPerformed
// TODO add your handling code here:
    Thread t = new Thread(){
        @Override
        public void run() {
            int i = 0;
            int bli = 0;
            int countNaoTem = 0;
            int sizeAnterior=0;
    
            ArrayList<Ponto> pontos = new ArrayList<Ponto>();
            while(true)
            {
                facade.getScreenShot2(bli, pontos);
                if(pontos.size()>sizeAnterior)
                {
                    sizeAnterior=pontos.size();
                    bli++;
                }else{
                    countNaoTem++;
                    if(countNaoTem>10) break;
                }
                try {
                    Thread.sleep(50);
                } catch (InterruptedException ex) {
                    Logger.getLogger(Principal3.class.getName()).log(Level.SEVERE, null, ex);
                }
                facade.moveZBack();
                i++;
            }
            System.out.println("Teste");
            for(Ponto p:pontos){
                System.out.println("("+p.getX()+","+p.getY()+","+p.getZ()+")");
            }
            System.out.println(pontos.size());
            System.out.println("Teste");
            imprimir(pontos);
            
        }
    };
    t.start();
//    System.out.println("Teste");
//    for(Ponto p:pontos){
//        System.out.println("("+p.getX()+","+p.getY()+","+p.getZ()+")");
//    }
//    System.out.println("Teste");
    
    
}//GEN-LAST:event_btnFatiouActionPerformed

private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
// TODO add your handling code here:
    JFileChooser jfc = new JFileChooser();
    STLFileFilter sff = new STLFileFilter();
    jfc.setFileFilter(sff);
    int returnVal = jfc.showOpenDialog(this);
    if(returnVal == JFileChooser.APPROVE_OPTION) {
       System.out.println("You chose to open this file: " +
           jfc.getSelectedFile().getAbsoluteFile());
           try {
                facade.loadStlFile(jfc.getSelectedFile().toURI().toURL());
            } catch (MalformedURLException ex) {
                Logger.getLogger(Principal3.class.getName()).log(Level.SEVERE, null, ex);
            }
    }
}//GEN-LAST:event_jMenuItem1ActionPerformed

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
    facade.centralizar();
}//GEN-LAST:event_jButton1ActionPerformed

private void btnAvancarXActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAvancarXActionPerformed
// TODO add your handling code here:
    statusMotor = "avancar";
    motores.get(MOTORX).setStatus(statusMotor);
}//GEN-LAST:event_btnAvancarXActionPerformed

private void btnAvancarUmXActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAvancarUmXActionPerformed
// TODO add your handling code here:
    statusMotor = "avancarUm";
    motores.get(MOTORX).setStatus(statusMotor);
}//GEN-LAST:event_btnAvancarUmXActionPerformed

private void btnPausaXActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPausaXActionPerformed
// TODO add your handling code here:
    statusMotor = "parado";
    motores.get(MOTORX).setStatus(statusMotor);
}//GEN-LAST:event_btnPausaXActionPerformed

private void btnRecuarUmXActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRecuarUmXActionPerformed
// TODO add your handling code here:
    statusMotor = "recuarUm";
    motores.get(MOTORX).setStatus(statusMotor);
}//GEN-LAST:event_btnRecuarUmXActionPerformed

private void btnRecuarXActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRecuarXActionPerformed
// TODO add your handling code here:
    statusMotor = "recuar";
    motores.get(MOTORX).setStatus(statusMotor);
}//GEN-LAST:event_btnRecuarXActionPerformed

private void btnAvancarYActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAvancarYActionPerformed
// TODO add your handling code here:
    statusMotor = "avancar";
    motores.get(MOTORY).setStatus(statusMotor);
}//GEN-LAST:event_btnAvancarYActionPerformed

private void btnAvancarUmYActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAvancarUmYActionPerformed
// TODO add your handling code here:
    statusMotor = "avancarUm";
    motores.get(MOTORY).setStatus(statusMotor);
}//GEN-LAST:event_btnAvancarUmYActionPerformed

private void btnPausaYActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPausaYActionPerformed
// TODO add your handling code here:
    statusMotor = "parado";
    motores.get(MOTORY).setStatus(statusMotor);
}//GEN-LAST:event_btnPausaYActionPerformed

private void btnRecuarUmYActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRecuarUmYActionPerformed
// TODO add your handling code here:
    statusMotor = "recuarUm";
    motores.get(MOTORY).setStatus(statusMotor);
}//GEN-LAST:event_btnRecuarUmYActionPerformed

private void btnRecuarYActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRecuarYActionPerformed
// TODO add your handling code here:
    statusMotor = "recuar";
    motores.get(MOTORY).setStatus(statusMotor);
}//GEN-LAST:event_btnRecuarYActionPerformed

private void btnAvancarZActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAvancarZActionPerformed
// TODO add your handling code here:
    statusMotor = "avancar";
    motoresCartao01.get(MOTORZ).setStatus(statusMotor);
}//GEN-LAST:event_btnAvancarZActionPerformed

private void btnAvancarUmZActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAvancarUmZActionPerformed
// TODO add your handling code here:
    statusMotor = "avancarUm";
    motoresCartao01.get(MOTORZ).setStatus(statusMotor);
}//GEN-LAST:event_btnAvancarUmZActionPerformed

private void btnPausaZActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPausaZActionPerformed
// TODO add your handling code here:
    statusMotor = "parado";
    motoresCartao01.get(MOTORZ).setStatus(statusMotor);
}//GEN-LAST:event_btnPausaZActionPerformed

private void btnRecuarUmZActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRecuarUmZActionPerformed
// TODO add your handling code here:
    statusMotor = "recuarUm";
    motoresCartao01.get(MOTORZ).setStatus(statusMotor);
}//GEN-LAST:event_btnRecuarUmZActionPerformed

private void btnRecuarZActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRecuarZActionPerformed
// TODO add your handling code here:
    statusMotor = "recuar";
    motoresCartao01.get(MOTORZ).setStatus(statusMotor);
}//GEN-LAST:event_btnRecuarZActionPerformed

private void btnAvancarDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAvancarDActionPerformed
// TODO add your handling code here:
    statusMotor = "avancar";
    motores.get(MOTORD).setStatus(statusMotor);
}//GEN-LAST:event_btnAvancarDActionPerformed

private void btnAvancarUmDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAvancarUmDActionPerformed
// TODO add your handling code here:
    statusMotor = "avancarUm";
    motores.get(MOTORD).setStatus(statusMotor);
}//GEN-LAST:event_btnAvancarUmDActionPerformed

private void btnPausaDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPausaDActionPerformed
// TODO add your handling code here:
    statusMotor = "parado";
    motores.get(MOTORD).setStatus(statusMotor);
}//GEN-LAST:event_btnPausaDActionPerformed

private void btnRecuarUmDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRecuarUmDActionPerformed
// TODO add your handling code here:
    statusMotor = "recuarUm";
    motores.get(MOTORD).setStatus(statusMotor);
}//GEN-LAST:event_btnRecuarUmDActionPerformed

private void btnRecuarDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRecuarDActionPerformed
// TODO add your handling code here:
    statusMotor = "recuar";
    motores.get(MOTORD).setStatus(statusMotor);
}//GEN-LAST:event_btnRecuarDActionPerformed

private void btnAvancarCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAvancarCActionPerformed
// TODO add your handling code here:
    statusMotor = "avancar";
    motoresCartao01.get(MOTORC).setStatus(statusMotor);
}//GEN-LAST:event_btnAvancarCActionPerformed

private void btnAvancarUmCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAvancarUmCActionPerformed
// TODO add your handling code here:
    statusMotor = "avancarUm";
    motoresCartao01.get(MOTORC).setStatus(statusMotor);
}//GEN-LAST:event_btnAvancarUmCActionPerformed

private void btnPausaCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPausaCActionPerformed
// TODO add your handling code here:
    statusMotor = "parado";
    motoresCartao01.get(MOTORC).setStatus(statusMotor);
}//GEN-LAST:event_btnPausaCActionPerformed

private void btnRecuarUmCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRecuarUmCActionPerformed
// TODO add your handling code here:
    statusMotor = "recuarUm";
    motoresCartao01.get(MOTORC).setStatus(statusMotor);
}//GEN-LAST:event_btnRecuarUmCActionPerformed

private void btnRecuarCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRecuarCActionPerformed
// TODO add your handling code here:
    statusMotor = "recuar";
    motoresCartao01.get(MOTORC).setStatus(statusMotor);
}//GEN-LAST:event_btnRecuarCActionPerformed

private void ComecarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ComecarActionPerformed
// TODO add your handling code here:
    //imprimir();
    teste();
}//GEN-LAST:event_ComecarActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Principal3().setVisible(true);
            }
        });
    }
    
    public void teste(){
        Thread t = new Thread(){
            @Override
            public void run() {
                //imprimir();
            }
        };
        t.start();
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Comecar;
    private javax.swing.JTextField atualCamada;
    private javax.swing.JTextField atualLinha;
    private javax.swing.JButton btnAvancarC;
    private javax.swing.JButton btnAvancarD;
    private javax.swing.JButton btnAvancarUmC;
    private javax.swing.JButton btnAvancarUmD;
    private javax.swing.JButton btnAvancarUmX;
    private javax.swing.JButton btnAvancarUmY;
    private javax.swing.JButton btnAvancarUmZ;
    private javax.swing.JButton btnAvancarX;
    private javax.swing.JButton btnAvancarY;
    private javax.swing.JButton btnAvancarZ;
    private javax.swing.JButton btnEscalar;
    private javax.swing.JButton btnEscalarBack;
    private javax.swing.JButton btnFatiou;
    private javax.swing.JButton btnMoverX;
    private javax.swing.JButton btnMoverXBack;
    private javax.swing.JButton btnMoverY;
    private javax.swing.JButton btnMoverYBack;
    private javax.swing.JButton btnMoverZ;
    private javax.swing.JButton btnMoverZBack;
    private javax.swing.JButton btnPausaC;
    private javax.swing.JButton btnPausaD;
    private javax.swing.JButton btnPausaX;
    private javax.swing.JButton btnPausaY;
    private javax.swing.JButton btnPausaZ;
    private javax.swing.JButton btnRecuarC;
    private javax.swing.JButton btnRecuarD;
    private javax.swing.JButton btnRecuarUmC;
    private javax.swing.JButton btnRecuarUmD;
    private javax.swing.JButton btnRecuarUmX;
    private javax.swing.JButton btnRecuarUmY;
    private javax.swing.JButton btnRecuarUmZ;
    private javax.swing.JButton btnRecuarX;
    private javax.swing.JButton btnRecuarY;
    private javax.swing.JButton btnRecuarZ;
    private javax.swing.JButton btnRotateX;
    private javax.swing.JButton btnRotateXBack;
    private javax.swing.JButton btnRotateY;
    private javax.swing.JButton btnRotateYBack;
    private javax.swing.JButton btnRotateZ;
    private javax.swing.JButton btnRotateZBack;
    private javax.swing.JButton btnScreenShot;
    private javax.swing.JCheckBox cbContarPassosC;
    private javax.swing.JCheckBox cbContarPassosD;
    private javax.swing.JCheckBox cbContarPassosX;
    private javax.swing.JCheckBox cbContarPassosY;
    private javax.swing.JCheckBox cbContarPassosZ;
    private javax.swing.JButton jButton1;
    private javax.swing.JDialog jDialog1;
    private javax.swing.JDialog jDialog2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu10;
    private javax.swing.JMenu jMenu11;
    private javax.swing.JMenu jMenu12;
    private javax.swing.JMenu jMenu13;
    private javax.swing.JMenu jMenu14;
    private javax.swing.JMenu jMenu15;
    private javax.swing.JMenu jMenu16;
    private javax.swing.JMenu jMenu17;
    private javax.swing.JMenu jMenu18;
    private javax.swing.JMenu jMenu19;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu20;
    private javax.swing.JMenu jMenu21;
    private javax.swing.JMenu jMenu22;
    private javax.swing.JMenu jMenu23;
    private javax.swing.JMenu jMenu24;
    private javax.swing.JMenu jMenu25;
    private javax.swing.JMenu jMenu26;
    private javax.swing.JMenu jMenu27;
    private javax.swing.JMenu jMenu28;
    private javax.swing.JMenu jMenu29;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu30;
    private javax.swing.JMenu jMenu31;
    private javax.swing.JMenu jMenu32;
    private javax.swing.JMenu jMenu33;
    private javax.swing.JMenu jMenu34;
    private javax.swing.JMenu jMenu35;
    private javax.swing.JMenu jMenu36;
    private javax.swing.JMenu jMenu37;
    private javax.swing.JMenu jMenu38;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu6;
    private javax.swing.JMenu jMenu7;
    private javax.swing.JMenu jMenu8;
    private javax.swing.JMenu jMenu9;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuBar jMenuBar10;
    private javax.swing.JMenuBar jMenuBar11;
    private javax.swing.JMenuBar jMenuBar12;
    private javax.swing.JMenuBar jMenuBar13;
    private javax.swing.JMenuBar jMenuBar14;
    private javax.swing.JMenuBar jMenuBar15;
    private javax.swing.JMenuBar jMenuBar16;
    private javax.swing.JMenuBar jMenuBar17;
    private javax.swing.JMenuBar jMenuBar18;
    private javax.swing.JMenuBar jMenuBar19;
    private javax.swing.JMenuBar jMenuBar2;
    private javax.swing.JMenuBar jMenuBar20;
    private javax.swing.JMenuBar jMenuBar21;
    private javax.swing.JMenuBar jMenuBar22;
    private javax.swing.JMenuBar jMenuBar23;
    private javax.swing.JMenuBar jMenuBar24;
    private javax.swing.JMenuBar jMenuBar25;
    private javax.swing.JMenuBar jMenuBar26;
    private javax.swing.JMenuBar jMenuBar27;
    private javax.swing.JMenuBar jMenuBar28;
    private javax.swing.JMenuBar jMenuBar29;
    private javax.swing.JMenuBar jMenuBar3;
    private javax.swing.JMenuBar jMenuBar30;
    private javax.swing.JMenuBar jMenuBar31;
    private javax.swing.JMenuBar jMenuBar32;
    private javax.swing.JMenuBar jMenuBar33;
    private javax.swing.JMenuBar jMenuBar34;
    private javax.swing.JMenuBar jMenuBar35;
    private javax.swing.JMenuBar jMenuBar36;
    private javax.swing.JMenuBar jMenuBar37;
    private javax.swing.JMenuBar jMenuBar38;
    private javax.swing.JMenuBar jMenuBar4;
    private javax.swing.JMenuBar jMenuBar5;
    private javax.swing.JMenuBar jMenuBar6;
    private javax.swing.JMenuBar jMenuBar7;
    private javax.swing.JMenuBar jMenuBar8;
    private javax.swing.JMenuBar jMenuBar9;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem10;
    private javax.swing.JMenuItem jMenuItem11;
    private javax.swing.JMenuItem jMenuItem12;
    private javax.swing.JMenuItem jMenuItem13;
    private javax.swing.JMenuItem jMenuItem14;
    private javax.swing.JMenuItem jMenuItem15;
    private javax.swing.JMenuItem jMenuItem16;
    private javax.swing.JMenuItem jMenuItem17;
    private javax.swing.JMenuItem jMenuItem18;
    private javax.swing.JMenuItem jMenuItem19;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem20;
    private javax.swing.JMenuItem jMenuItem21;
    private javax.swing.JMenuItem jMenuItem22;
    private javax.swing.JMenuItem jMenuItem23;
    private javax.swing.JMenuItem jMenuItem24;
    private javax.swing.JMenuItem jMenuItem25;
    private javax.swing.JMenuItem jMenuItem26;
    private javax.swing.JMenuItem jMenuItem27;
    private javax.swing.JMenuItem jMenuItem28;
    private javax.swing.JMenuItem jMenuItem29;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem30;
    private javax.swing.JMenuItem jMenuItem31;
    private javax.swing.JMenuItem jMenuItem32;
    private javax.swing.JMenuItem jMenuItem33;
    private javax.swing.JMenuItem jMenuItem34;
    private javax.swing.JMenuItem jMenuItem35;
    private javax.swing.JMenuItem jMenuItem36;
    private javax.swing.JMenuItem jMenuItem37;
    private javax.swing.JMenuItem jMenuItem38;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JMenuItem jMenuItem9;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanelPreview;
    private javax.swing.JPanel jPanelWorkArea;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField10;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JTextField jTextField5;
    private javax.swing.JTextField jTextField6;
    private javax.swing.JTextField jTextField7;
    private javax.swing.JTextField jTextField8;
    private javax.swing.JTextField jTextField9;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JTextField nCamadas;
    private javax.swing.JTextField nLinhas;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    private javax.swing.JSeparator statusPanelSeparator;
    private javax.swing.JTextField tamX;
    private javax.swing.JTextField tamY;
    private javax.swing.JTextField tamZ;
    private javax.swing.JTextField tfAnguloX;
    private javax.swing.JTextField tfAnguloY;
    private javax.swing.JTextField tfAnguloZ;
    private javax.swing.JTextField tfDeslocamentoX;
    private javax.swing.JTextField tfDeslocamentoY;
    private javax.swing.JTextField tfDeslocamentoZ;
    private javax.swing.JTextField tfEscala;
    private javax.swing.JTextField tfQtdPassosC;
    private javax.swing.JTextField tfQtdPassosD;
    private javax.swing.JTextField tfQtdPassosX;
    private javax.swing.JTextField tfQtdPassosY;
    private javax.swing.JTextField tfQtdPassosZ;
    private javax.swing.JTextField tfResC;
    private javax.swing.JTextField tfResD;
    private javax.swing.JTextField tfResX;
    private javax.swing.JTextField tfResY;
    private javax.swing.JTextField tfResZ;
    private javax.swing.JTextField tfVeloC;
    private javax.swing.JTextField tfVeloD;
    private javax.swing.JTextField tfVeloX;
    private javax.swing.JTextField tfVeloY;
    private javax.swing.JTextField tfVeloZ;
    // End of variables declaration//GEN-END:variables

    public void imprimir(ArrayList<Ponto> pontos) {
        //System.out.println("entrei aqui 2000 " + pontos.size());
        motores.get(MOTORX).velo2 = new JTextField("1");
        motores.get(MOTORY).velo2 = new JTextField("1");
        motoresCartao01.get(MOTORZ).velo2 = new JTextField("1");
        
        motores.get(MOTORX).contarPassos.setSelected(false);
        motores.get(MOTORY).contarPassos.setSelected(false);
        motoresCartao01.get(MOTORZ).contarPassos.setSelected(false);
        
        
        motores.get(MOTORX).setStatus("avancar");
        motores.get(MOTORY).setStatus("avancar");
        motoresCartao01.get(MOTORZ).setStatus("recuar");
        
        while ((motores.get(MOTORX).getStatus() != "parado") || (motores.get(MOTORY).getStatus() != "parado") || (motoresCartao01.get(MOTORZ).getStatus() != "parado")) {
            try {
                Thread.sleep(1);
            } catch (InterruptedException ex) {
                Logger.getLogger(Principal3.class.getName()).log(Level.SEVERE, null, ex);
            }
            //System.out.println("entrei aqui 2 " + motores.get(MOTORX).getStatus().toString());
            //System.out.println("entrei aqui 2 " + motoresCartao01.get(MOTORZ).getStatus().toString());
            //System.out.println("entrei aqui 2 " + motores.get(MOTORY).getStatus().toString());
        }
        
        motores.get(MOTORY).contarPassos.setSelected(true);
        motores.get(MOTORX).contarPassos.setSelected(true);
        
        //System.out.println("entrei aqui 3");
        
        motores.get(MOTORY).contadorPassos = PIXELY*INICIOY;
        motores.get(MOTORX).contadorPassos = PIXELX*INICIOX;
        
        motores.get(MOTORX).setStatus("recuar");
        motores.get(MOTORY).setStatus("recuar");
        
        while ((motores.get(MOTORX).getStatus() != "parado") || (motores.get(MOTORY).getStatus() != "parado")) {
            try {
                Thread.sleep(1);
            } catch (InterruptedException ex) {
                Logger.getLogger(Principal3.class.getName()).log(Level.SEVERE, null, ex);
            }
            //System.out.println("entrei aqui 4");
        }
        
        motores.get(MOTORD).contarPassos.setSelected(true);
        motores.get(MOTORD).velo2 = new JTextField("900");
        motores.get(MOTORD).contadorPassos = INICIOD;
        motores.get(MOTORD).setStatus("avancar");
        
        //System.out.println("entrei aqui 5");
        
        while (motores.get(MOTORD).getStatus() != "parado") {
            try {
                Thread.sleep(1);
            } catch (InterruptedException ex) {
                Logger.getLogger(Principal3.class.getName()).log(Level.SEVERE, null, ex);
            }
            //System.out.println("entrei aqui 6");
        }
        
        motores.get(MOTORD).contarPassos.setSelected(false);
        motores.get(MOTORD).setStatus("avancar");
        
        motores.get(MOTORY).contarPassos.setSelected(true);
        motores.get(MOTORY).velo2 = new JTextField("27");
        motores.get(MOTORY).contadorPassos = PIXELY*35;
        motores.get(MOTORY).setStatus("recuar");
        
        //System.out.println("entrei aqui 7");
        
        while (motores.get(MOTORY).contadorPassos > 0) {                                       
            try {
                Thread.sleep(1);
            } catch (InterruptedException ex) {
                Logger.getLogger(Principal3.class.getName()).log(Level.SEVERE, null, ex);
            }
            //System.out.println("entrei aqui 8");
        }
        
        ArrayList<Ponto> trajeto = pontos;
        
        int x = 0;
        int y = 0;
        int z = 0;
        
        //System.out.println("entrei aqui 1000 " + trajeto.size());
        
        for(int p=0;p<(trajeto.size());p++){
            Ponto ponto = trajeto.get(p);
            int pontoX = ponto.getY()-80;
            int pontoY = ponto.getX()-80;
            int pontoZ = ponto.getZ();
            //System.out.println("("+ponto.getX()+","+ponto.getY()+","+ponto.getZ()+")");
            //System.exit(-1);
            if (z != pontoZ) {
                motoresCartao01.get(MOTORZ).contarPassos.setSelected(true);            
                motoresCartao01.get(MOTORZ).contadorPassos = PIXELZ;
                motoresCartao01.get(MOTORZ).setStatus("avancar");
            
                motores.get(MOTORD).setStatus("parado");
                while (motoresCartao01.get(MOTORZ).contadorPassos > 0) {
                    try {
                        Thread.sleep(1);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(Principal3.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
                motores.get(MOTORD).setStatus("avancar");
            }
            
            if (x < pontoX) {
                motores.get(MOTORX).contarPassos.setSelected(true);
                motores.get(MOTORX).velo2 = new JTextField("1");
                motores.get(MOTORX).contadorPassos = PIXELX;
                motores.get(MOTORX).setStatus("recuar");
        
                motores.get(MOTORD).setStatus("parado");
                while (motores.get(MOTORX).contadorPassos > 0) {                                       
                    try {
                        Thread.sleep(1);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(Principal3.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
                motores.get(MOTORD).setStatus("avancar");
                
            } else if (x > pontoX) {
                motores.get(MOTORX).contarPassos.setSelected(true);
                motores.get(MOTORX).velo2 = new JTextField("1");
                motores.get(MOTORX).contadorPassos = PIXELX;
                motores.get(MOTORX).setStatus("avancar");
        
                motores.get(MOTORD).setStatus("parado");
                while (motores.get(MOTORX).contadorPassos > 0) {                                       
                    try {
                        Thread.sleep(1);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(Principal3.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
                motores.get(MOTORD).setStatus("avancar");
            }
            
            if (y < pontoY) {
                motores.get(MOTORY).contarPassos.setSelected(true);
                motores.get(MOTORY).velo2 = new JTextField("27");
                motores.get(MOTORY).contadorPassos = PIXELY*(pontoY-y);
                motores.get(MOTORY).setStatus("recuar");
        
                while (motores.get(MOTORY).contadorPassos > 0) {                                       
                    try {
                        Thread.sleep(1);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(Principal3.class.getName()).log(Level.SEVERE, null, ex);
                    }
                motores.get(MOTORD).setStatus("avancar");
                }
            } else if (y > pontoY) {
                motores.get(MOTORY).contarPassos.setSelected(true);
                motores.get(MOTORY).velo2 = new JTextField("27");
                motores.get(MOTORY).contadorPassos = PIXELY*(y-pontoY);
                motores.get(MOTORY).setStatus("avancar");
        
                while (motores.get(MOTORY).contadorPassos > 0) {                                       
                    try {
                        Thread.sleep(1);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(Principal3.class.getName()).log(Level.SEVERE, null, ex);
                    }
                motores.get(MOTORD).setStatus("avancar");
                }
            }
            x = pontoX;
            y = pontoY;
            z = pontoZ;
        }
        motoresCartao01.get(MOTORZ).contarPassos.setSelected(false);            
        motoresCartao01.get(MOTORZ).setStatus("avancar");
        
        motores.get(MOTORD).setStatus("parado");
    }
    
    public void run() {
        JOpc jopc = new JOpc("localhost", "RSLinx OPC Server", "NovoOK");
    
        try {
            JOpc.coInitialize();
        }
        catch (CoInitializeException e1) {
            e1.printStackTrace();
        }
    
        OpcItem item1 = new OpcItem("[NovoOK]O:2.0", true, "");
        OpcItem item2 = new OpcItem("[NovoOK]O:1.0", true, "");
        
        //
        //OpcItem leituraTermopar = new OpcItem("[NovoOK]I:4.0", true, "");
        //Bloco - 12
        //OpcItem leituraTermopar2 = new OpcItem("[NovoOK]I:4.7", true, "");
        
        //OpcItem leituraTermopar3 = new OpcItem("[NovoOK]I:4.2", true, "");
        
        //inicio edição teste - chaves de fim de curso
        OpcItem fimCursoZ = new OpcItem("[NovoOK]I:3.0/7", true, "");
        OpcItem fimCursoX = new OpcItem("[NovoOK]I:3.0/13", true, "");
        OpcItem fimCursoY = new OpcItem("[NovoOK]I:3.0/11", true, "");
        OpcItem fimCursoDep = new OpcItem("[NovoOK]I:3.0/9", true, "");
        OpcItem fimCursoCum = new OpcItem("[NovoOK]I:3.0/5", true, "");
        //fim edição teste
        
        OpcGroup group = new OpcGroup("group1", true, 10000, 0.0f);
    
        group.addItem(item1);
        group.addItem(item2);
        //group.addItem(leituraTermopar);
        //group.addItem(leituraTermopar2);
        //group.addItem(leituraTermopar3);
        
        //inicio edição teste - chaves de fim de curso
        group.addItem(fimCursoZ);
        group.addItem(fimCursoX);
        group.addItem(fimCursoY);
        group.addItem(fimCursoDep);
        group.addItem(fimCursoCum);
        //fim edição teste
        
        try {
            jopc.connect();
            System.out.println("OPC is connected...");
            jopc.addGroup(group);
      
            jopc.registerGroup(group);
            System.out.println("Group was registred...");
            jopc.registerItem(group, item1);
            jopc.registerItem(group, item2);
            //jopc.registerItem(group, leituraTermopar);
            //jopc.registerItem(group, leituraTermopar2);
            //jopc.registerItem(group, leituraTermopar3);
            
            //inicio edição teste - chaves de fim de curso
            jopc.registerItem(group, fimCursoZ);
            jopc.registerItem(group, fimCursoX);
            jopc.registerItem(group, fimCursoY);
            jopc.registerItem(group, fimCursoDep);
            jopc.registerItem(group, fimCursoCum);
            //fim edição teste
            
            MotorPasso X = new MotorPasso();
            X.setNome("X");
            X.setSaidasCLP("0,1,2,3");
            X.setTextField(tfResX);
            X.contarPassos = cbContarPassosX;
            X.qtdPassos = tfQtdPassosX;
            //X.velo = slVeloX;
            X.velo2 = tfVeloX;
            Thread tX = new Thread(X);
            tX.start();
            X.myThread = tX;
            motores.add(X);
            
            MotorPasso Y = new MotorPasso();
            Y.setNome("Y");
            Y.setSaidasCLP("4,5,6,7");
            Y.setTextField(tfResY);
            Y.setModoOperacao("meioPasso");
            Y.contarPassos = cbContarPassosY;
            Y.qtdPassos = tfQtdPassosY;
            //Y.velo = slVeloY;
            Y.velo2 = tfVeloY;
            Thread tY = new Thread(Y);
            tY.start();
            Y.myThread = tY;
            motores.add(Y);
            
            MotorPasso D = new MotorPasso();
            D.setNome("D");
            D.setSaidasCLP("12,9,10,11");
            D.setTextField(tfResD);
            D.setModoOperacao("passoCompleto2bobina");
            D.contarPassos = cbContarPassosD;
            D.qtdPassos = tfQtdPassosD;
            //D.velo = slVeloD;
            D.velo2 = tfVeloD;
            Thread tD = new Thread(D);
            tD.start();
            D.myThread = tD;
            motores.add(D);                        
            
            MotorPasso Z = new MotorPasso();
            Z.setNome("Z");
            Z.setSaidasCLP("0,1,2,3");
            Z.setTextField(tfResZ);
            Z.contarPassos = cbContarPassosZ;
            Z.qtdPassos = tfQtdPassosZ;
            //Z.velo = slVeloZ;
            Z.velo2 = tfVeloZ;
            Thread tZ = new Thread(Z);
            tZ.start();
            Z.myThread = tZ;
            motoresCartao01.add(Z);
            
            MotorPasso C = new MotorPasso();
            C.setNome("C");
            C.setSaidasCLP("4,5,6,7");
            C.setTextField(tfResC);
            C.contarPassos = cbContarPassosC;
            C.qtdPassos = tfQtdPassosC;
            //C.velo = slVeloC;
            C.velo2 = tfVeloC;
            Thread tC = new Thread(C);
            tC.start();
            C.myThread = tC;
            motoresCartao01.add(C);            
            
            ArrayList<Integer> motor1 = new ArrayList<Integer>();
            motor1.add(0); motor1.add(1); motor1.add(2); motor1.add(3);
            
            int i = 0;
            
            boolean hasChange = false;
            int passo = 0;
            
            boolean hasChange2 = false;
            int passo2 = 0;
            
            VariantList list = new VariantList(Variant.VT_I2);
            
            VariantList list2 = new VariantList(Variant.VT_I2);
            //aqui vem o loop
            
            
            //Integer termInt1 = 0;
            //Integer termInt2 = 0;
            //Integer termInt3 = 0;
            
            //String termVar1 = "";
            //String termVar2 = "";
            //String termVar3 = "";
            
            int counterLeSensores = 0;
            
            while(true){
                
                //counterLeSensores++;
                
                
                try {
                    Thread.sleep(1);
                } catch (InterruptedException ex) {
                    Logger.getLogger(Principal3.class.getName()).log(Level.SEVERE, null, ex);
                }
                
//                if(counterLeSensores>120){
//                    //Le do termopar
//                    OpcItem itemRead = null;
//                    itemRead = jopc.synchReadItem(group, leituraTermopar);
//                    termVar1 = itemRead.getValue().toString();
//                    termInt1 = Integer.parseInt(termVar1);
//
//                    OpcItem itemRead2 = null;
//                    itemRead2 = jopc.synchReadItem(group, leituraTermopar2);
//                    termVar2 = itemRead2.getValue().toString();
//                    termInt2 = Integer.parseInt(termVar2);
//
//                    OpcItem itemRead3 = null;
//                    itemRead3 = jopc.synchReadItem(group, leituraTermopar3);
//                    termVar3 = itemRead3.getValue().toString();
//                    termInt3 = Integer.parseInt(termVar3);
//                    counterLeSensores=0;
//                }
                
                //inicio edição teste - chave fim de curso
                OpcItem FCZItemRead = null;
                FCZItemRead = jopc.synchReadItem(group, fimCursoZ);
                String fimZ = FCZItemRead.getValue().toString();
                Integer intFimZ = Integer.parseInt(fimZ);
                if (intFimZ == 1) Z.setStatus("recuarUm");
                
                OpcItem FCXItemRead = null;
                FCXItemRead = jopc.synchReadItem(group, fimCursoX);
                String fimX = FCXItemRead.getValue().toString();
                Integer intFimX = Integer.parseInt(fimX);
                if (intFimX == 1) X.setStatus("recuarUm");
                
                OpcItem FCYItemRead = null;
                FCYItemRead = jopc.synchReadItem(group, fimCursoY);
                String fimY = FCYItemRead.getValue().toString();
                Integer intFimY = Integer.parseInt(fimY);
                if (intFimY == 1) Y.setStatus("recuarUm");
               
                OpcItem FCDItemRead = null;
                FCDItemRead = jopc.synchReadItem(group, fimCursoDep);
                String fimD = FCDItemRead.getValue().toString();
                Integer intFimD = Integer.parseInt(fimD);               
                if (intFimD == 1) D.setStatus("avancarUm");
                
                OpcItem FCCItemRead = null;
                FCCItemRead = jopc.synchReadItem(group, fimCursoCum);
                String fimC = FCCItemRead.getValue().toString();
                Integer intFimC = Integer.parseInt(fimC);
                if (intFimC == 1) Z.setStatus("avancarUm");
                //fim edição teste
                
                //Atualizar a interface
                //jTextField1.setText(termVar1);
                
                //jTextField4.setText(termVar2);
                
                //jTextField8.setText(termVar3);
                          
               
                
                //Se temperatura estiver abaixo de valor 1 ligue o rele
//                int resTerm1 = 0;
//                
//                int term1 = Integer.parseInt(jTextField2.getText());
//                if(termInt1 < term1){
//                    resTerm1 = (int)Math.pow(2, 14);
//                }
//                
//                int term2 = Integer.parseInt(jTextField3.getText());
//                if(termInt1 > term2){
//                    resTerm1 = 0;
//                }
//                
//                
//                int resTerm2 = 0;
//                
//                int term3 = Integer.parseInt(jTextField5.getText());
//                if(termInt2 < term3){
//                    resTerm2 = (int)Math.pow(2, 13);
//                }
//                
//                int term4 = Integer.parseInt(jTextField6.getText());
//                if(termInt2 > term4){
//                    resTerm2 = 0;
//                }
//                
//                int resTerm3 = 0;
//                
//                int term5 = Integer.parseInt(jTextField9.getText());
//                if(termInt3 < term5){
//                    resTerm3 = -(int)Math.pow(2, 15);
//                }
//                
//                int term6 = Integer.parseInt(jTextField10.getText());
//                if(termInt3 > term6){
//                    resTerm3 = 0;
//                }
//                
                
                hasChange = false;
                for(MotorPasso motor : motores){
                    if(motor.hasChange){
                        hasChange = true;
                    }
                    motor.coletou = true;
                    passo += motor.getPasso();
                }
                
                hasChange2 = false;
                for(MotorPasso motor : motoresCartao01){
                    if(motor.hasChange)
                    {
                        hasChange2 = true;
                    }
                    
                    passo2 += motor.getPasso();
                    motor.coletou = true;
                }

                        
                
                
                
                /*
                 ESSA PARTE É RELATIVA AO CARTAO 2
                 
                 */
                
                //Liga ou desliga as saidas do CLP
                list.clear();
                Variant v = new Variant(passo);
                list.add(v);
                //list.add(new Variant(passo));
            
                Variant varin = new Variant(list);               
                
                item1.setValue(varin);
                
                jopc.synchWriteItem(group, item1);
                
                v = null;
                varin = null;
                
                Integer res = passo;
                
                hasChange = false;
                passo = 0;
                
                
                
                /*
                 ESSA PARTE É RELATIVA AO CARTAO 1
                 
                 */
                
                
                //Liga ou desliga as saidas do CLP
                list2.clear();
                v = new Variant(passo2);
                list2.add(v);
                //list.add(new Variant(passo));
            
                varin = new Variant(list2);
                item2.setValue(varin);
                
                if(hasChange2){
                    jopc.synchWriteItem(group, item2);
                    //System.out.println("Cartao 2");
                }
                
                v = null;
                varin = null;
                
                hasChange2 = false;
                passo2 = 0;
                
                
                
                jTextField7.setText(res.toString());
                
            }
            
       }catch (ConnectivityException e) {
            e.printStackTrace();
       }
        catch (ComponentNotFoundException e) {
          e.printStackTrace();
        }
        catch (UnableAddGroupException e) {
          e.printStackTrace();
        }
        catch (UnableAddItemException e) {
          e.printStackTrace();
        }
        catch (SynchReadException e) {
          e.printStackTrace();
        }
        catch (SynchWriteException e) {
          e.printStackTrace();
        }
        catch (CoUninitializeException e) {
          e.printStackTrace();
        }
    }
}
